<?php
class Environment {

    const
        LOCAL = 'LOCAL',
        DEVELOPMENT = 'DEVELOPMENT',
        PRODUCTION = 'PRODUCTION';

    private static $_envVar = 'YII_ENVIRONMENT';

    public static function init($env = '') {
        if (empty($env))
            $env = self::LOCAL;

        define(self::$_envVar, $env);
    }

    public static function isLocal() {
        if (defined(self::$_envVar)) {
            return in_array(YII_ENVIRONMENT, array(self::LOCAL)) ? true : false;
        } else {
            return true;
        }
    }

    public static function isDevelopment() {
        if (defined(self::$_envVar)) {
            return in_array(YII_ENVIRONMENT, array(self::LOCAL, self::DEVELOPMENT)) ? true : false;
        }
        else
            return true;
    }

    public static function isProduction() {
        if (defined(self::$_envVar)) {
            return in_array(YII_ENVIRONMENT, array(self::PRODUCTION)) ? true : false;
        }
        else
            return false;
    }

}//end class
Environment::init(); // local
//Environment::init(Environment::DEVELOPMENT); // development
//Environment::init(Environment::PRODUCTION); // production